package com.stockz.indicator.vsa.pattern;

import java.util.List;

import org.springframework.stereotype.Component;

import com.stockz.core.model.Bar;
import com.stockz.indicator.vsa.VsaBar;
import com.stockz.indicator.vsa.property.Close;
import com.stockz.indicator.vsa.property.Region;
import com.stockz.indicator.vsa.property.Type;
import com.stockz.indicator.vsa.property.Volume;

@Component
public class NoSupply extends VsaPattern {

	public NoSupply(){
		super("NS","No Supply",VsaPatternType.Bullish);
	}
	
	@Override
	public void analyze(List<Bar> barList,List<VsaBar> vsaBarList, int index) {
		VsaBar vsaBar = vsaBarList.get(index);
		/*if(!Region.OverBaught.equals(vsaBar.getRegion())
				&& Close.Low.equals(vsaBar.getClose())
				&& Spread.Narrow.equals(vsaBar.getSpread())
				&& Volume.Low.equals(vsaBar.getVolume())
				&& Type.Down.equals(vsaBar.getType())
				&& Type.Up.equals(vsaBar.getNextType())){
			vsaBar.getVsaPatternList().add(this);
		}*/
		
		/*if(index < barList.size()-2){
			if(barList.get(index).getVolume() < barList.get(index+1).getVolume()
					&& barList.get(index).getVolume() < barList.get(index+2).getVolume()){
				if(!Region.OverBaught.equals(vsaBar.getRegion())
						&& Close.Low.equals(vsaBar.getClose())
						&& (Spread.Narrow.equals(vsaBar.getSpread()) || Spread.UltraNarrow.equals(vsaBar.getSpread()) ) 
						&& Volume.Low.equals(vsaBar.getVolume())
						&& Type.Down.equals(vsaBar.getType())){
					vsaBar.getVsaPatternList().add(this);
				}
			}
		}*/
		
		
		
		if(/*(Spread.Narrow.equals(vsaBar.getSpread()) ||
				Spread.UltraNarrow.equals(vsaBar.getSpread()))
				&& */Type.Down.equals(vsaBar.getType())
				&& (Volume.Low.equals(vsaBar.getVolume()) || Volume.Average.equals(vsaBar.getVolume()))
				&& !Region.OverBaught.equals(vsaBar.getRegion())
				&&( !Close.Low.equals(vsaBar.getClose()) || Type.Up.equals(vsaBar.getNextType()))){
			vsaBar.getVsaPatternList().add(this);
		}
		
		
	}
}
